import { Form } from '@ant-design/compatible';
import '@ant-design/compatible/assets/index.css';
import React, { useState, useCallback, useEffect } from 'react';
import { useRequest } from '@umijs/hooks';
import { Button, Result } from 'antd';
import styles from './index.less';
import moment from 'moment';
import router from 'umi/router';

import { Const } from '../../Const';

import AuthComponent from '@/components/Authorized/AuthComponent';

const Setp4 = props => {

  // lessLuggage.downloadImg

  const { prevStep, nextStep, className, ownerType, accidentId, isFromQuickRetrieval } = props;

  const goBack = useCallback(() => {
    let urlObj = {
      1: '/inPortBaggageManagement/damagedBaggageManagement',
      2: '/inPortBaggageManagement/lessBaggageManagement',
      3: '/inPortBaggageManagement/moreBaggageManagement',
      6: '/inPortBaggageManagement/internalMissingManagement',
      7: '/outPortBaggageManagement/damagedBaggageManagement',
    }
    // 是否来自监控页
    if (isFromQuickRetrieval) {
      router.push({
        pathname: Const.commonUrl + '/systemIndex',
      });
    } else {
      router.push({
        pathname: Const.commonUrl + urlObj[ownerType],
      });
    }
  }, [ownerType, isFromQuickRetrieval]);

  return (
    <div className={`${styles.stepWrapper} ${className}`}>
      <div className={styles.stepContent}>
        <Result
          status="success"
          title="成功"
          extra={[
            <Button type="primary" key="console" onClick={() => {
              router.push({
                pathname: Const.commonUrl + '/inPortBaggageManagement/printPage',
                state: {
                  accidentId: accidentId || '',
                  type: '6',
                  ownerType: ownerType
                }
              });
            }}>打印</Button>,
            <Button key="back" onClick={goBack}>返回列表</Button>,
          ]}
        ></Result>
      </div>
      {/* <div className={styles.btnBox}>
        <Button onClick={prevStep} style={{ marginRight: '10px' }}>上一步</Button>
        <Button type="primary" onClick={nextStep}>下一步</Button>
      </div> */}
    </div>
  )
}

export default Form.create()(Setp4);
